Communication apparatus and a control method relating communication with a target apparatus by using wireless communication method

ABSTRACT

A communication apparatus capable of performing near field communication acquires communication information of a target apparatus through the near field communication, determines whether or not the target apparatus is connected to an access point to which the communication apparatus is connected, on the basis of the communication information, and accepts the target apparatus as a target to which the communication apparatus is to be connected by using a peer-to-peer communication system, when it is determined that the target apparatus is not connected to the access point to which the communication apparatus is connected.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of U.S. patent applicationSer. No. 14/729,978, filed on Jun. 3, 2015, which claims priority fromJapanese Patent Application No. 2014-117848 filed Jun. 6, 2014 andJapanese Patent Application No. 2015-012709 filed Jan. 26, 2015. All ofthe above-listed applications are hereby incorporated by referenceherein in their entireties.

BACKGROUND OF THE INVENTION Field of the Invention

The present invention relates to communication apparatuses, andparticularly to a communication technology in which near fieldcommunication is enabled.

Description of the Related Art

Recently, external apparatuses, such as a digital camera and a mobiletelephone, specify communication targets with which communication is tobe performed, by using a near field communication system including nearfield communication (NFC). Systems are known which output image filesheld in a digital camera or a mobile telephone by using an image outputapparatus through wireless communication other than near fieldcommunication.

As part of a network function, some systems have a remote print functionand a firmware update function which are performed via the Internet byestablishing a connection to the Internet via an access point. Even in astate in which no access points are present, a host terminal may use anaccess point function provided for an image output apparatus, so as toestablish a peer-to-peer (P2P) connection between the host terminal andthe image output apparatus, thereby performing printing and scanning. Amode in which a host terminal performs wireless communication in a P2Pmanner by using the access point function provided for an image outputapparatus is called the access point (AP) mode.

However, when the image output apparatus enters the AP mode, the imageoutput apparatus is connected to the host terminal in a P2P manner, andthe connection to an access point is interrupted, whereby the Internetconnection fails to work. As a result, the image output apparatus mayfail to use the above-described various functions which need theInternet connection.

When the connection target in a P2P connection fails to connect to theInternet, the host terminal operating in the AP mode will also fail toconnect to the Internet. In this condition, an application in the hostterminal also fails to access the Internet. For example, sites on theInternet fail to be viewed from a browser.

In Japanese Patent Laid-Open No. 2011-182449, a technique is disclosedin which, when a first wireless communication apparatus is moved closeto a second wireless communication apparatus, if the first wirelesscommunication apparatus is performing data communication via an accesspoint, the first wireless communication apparatus does not switch to aP2P connection to the second wireless communication apparatus.

However, in the technique in Japanese Patent Laid-Open No. 2011-182449,when the first wireless communication apparatus does not perform datacommunication with the Internet via an access point, the communicationsetting of the first wireless communication apparatus is changed to P2Pconnection. For example, when the first wireless communication apparatusreceives a connection request from the second wireless communicationapparatus in the state in which the first wireless communicationapparatus does not perform data communication with the Internet via anaccess point, the first wireless communication apparatus switches to P2Pconnection. After that, even when a user wants to get connected to theInternet by using the first wireless communication apparatus while thefirst and second communication apparatuses are connected to each otherin a P2P manner, the user needs to wait until the P2P connection ends,in order to perform an operation intended by the user. Therefore,customer convenience may be reduced.

SUMMARY OF THE INVENTION

The present invention provides a communication apparatus capable ofperforming near field communication. The communication apparatusincludes an acquiring unit, a determination unit, and an accepting unit.The acquiring unit acquires communication information of a targetapparatus through the near field communication. The determination unitdetermines whether or not the target apparatus is connected to an accesspoint to which the communication apparatus is connected, on the basis ofthe communication information. The accepting unit accepts the targetapparatus as a target to which the communication apparatus is to beconnected by using a peer-to-peer communication system, when it isdetermined that the target apparatus is not connected to the accesspoint to which the communication apparatus is connected.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments with reference to theattached drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram illustrating the configuration of a print systemaccording to an embodiment of the present invention.

FIG. 2 is a diagram illustrating an outer appearance of a terminal.

FIGS. 3A and 3B are diagrams illustrating outer appearances of aprinter.

FIG. 4 is a block diagram illustrating the configuration of theterminal.

FIG. 5 is a block diagram illustrating the configuration of the printer.

FIG. 6 is a block diagram illustrating the configuration of an NFC unit.

FIG. 7 is a flowchart of a process performed in a first embodiment.

FIG. 8 is a flowchart of a process performed in a second embodiment.

FIGS. 9A to 9E are diagrams illustrating exemplary user interfaces (UIs)of the terminal.

FIG. 10 is a flowchart of a process performed in a third embodiment.

DESCRIPTION OF THE EMBODIMENTS

Exemplary embodiments of the invention will be described below in detailwith reference to the drawings. Unless otherwise specified, it is notintended that the scope of the invention be not limited to the relativeconfiguration of the components, the display screens, and the like whichare described in the present embodiments. Each of the embodiments of thepresent invention described below can be implemented solely or as acombination of a plurality of the embodiments or features thereof wherenecessary or where the combination of elements or features fromindividual embodiments in a single embodiment is beneficial.

First Embodiment

FIG. 1 is a diagram illustrating the configuration of a print system.The system includes an access point 100 located at the center, and alsoincludes a mobile terminal 200 and a printer 300 which are connectableto the access point 100. The terminal 200 which also serves as acommunication apparatus includes at least two types of wirelesscommunication units whose communication speeds are different from eachother. As long as the terminal 200 is an apparatus which can handlefiles to be printed, such as a personal information terminal, e.g., apersonal digital assistant (PDA), a mobile telephone, and a digitalcamera, any type of apparatus may be used.

The printer 300 which also serves as a communication apparatus has areading function of reading a document on the platen glass, and a printfunction of performing printing by using a print engine such as anink-jet print engine. In addition, the printer 300 may have a facsimile(FAX) function and a telephone function.

The printer 300 is capable of establishing a wireless local-area network(LAN) connection in the infrastructure mode. That is, the printer 300which is operating in the infrastructure mode is capable of performingwireless communication with the terminal 200 via the external accesspoint 100. The printer 300 also has the AP mode. In the AP mode, theterminal 200 and the printer 300 are also capable of performing P2Pcommunication with each other through a wireless LAN. As describedabove, in the AP mode, the access point function provided for a printeris activated, and the terminal 200 uses the access point of the printerto perform wireless peer-to-peer communication with the printer.

FIG. 2 is a diagram illustrating an outer appearance of the terminal200. In the first embodiment, a smartphone is taken as an example. Asmartphone is a multi-function mobile telephone provided with a camera,a net browser, a mail function, and the like as well as a mobiletelephone function. An NFC unit 201 performs near field communication. Auser brings the NFC unit 201 to the vicinity of an NFC unit of a target(in the first embodiment, an NFC unit of the printer 300) within apredetermined distance (about 10 cm), enabling communication to beperformed. That is, the terminal 200 is capable of performing near fieldcommunication.

A wireless LAN unit 202 which performs communication through a wirelessLAN is disposed in the terminal 200. A display unit 203 is a displayprovided with, for example, a display mechanism using a liquid crystaldisplay (LCD) system. An operation unit 204 is provided with anoperation mechanism using a touch panel system, and detects a pressingoperation performed by a user. In a typical operation, the display unit203 displays button icons and a software keyboard, and a user pressesthe operation unit 204, whereby an event of pressing a button is issued.A power supply key 205 is used when the power supply is turned on oroff.

FIGS. 3A and 3B are diagrams illustrating outer appearances of theprinter 300. In the first embodiment, a multi-function printer (MFP)having a reading function (scanner) is taken as an example. In FIG. 3A,platen glass 301 which is a transparent glass plate is used when adocument is put on the plate so as to be scanned by using the scanner. Aplaten cover 302 prevents reading light from being emitted to theoutside when the scanner is used to perform a reading operation. Aprint-sheet input slot 303 is an input slot for setting various sizes ofsheets of paper. Sheets of paper which are set in the print-sheet inputslot 303 are conveyed to the print unit one by one, are subjected toprinting, and are discharged from a print-sheet output slot 304.

In FIG. 3B, an operation display unit 305 and an NFC unit 306 aredisposed on the top of the platen cover 302. The NFC unit 306 whichperforms near field communication is a portion of the printer 300, tothe vicinity of which a user brings the terminal 200. The effectivedistance of the contact is a predetermined distance (about 10 cm) fromthe NFC unit 306. A wireless LAN antenna 307 is embedded to performwireless LAN communication.

Near field communication means wireless communication which is typifiedby NFC and whose communication range is a predetermined range which isrelatively small (for example, several centimeters to 1 m).

FIG. 4 is a block diagram illustrating the configuration of the terminal200. The terminal 200 includes a main board 210 which controls theentire apparatus, the wireless LAN unit 202, the NFC unit 201, a lineconnection unit 206, the operation unit 204, and the display unit. Eachof the wireless LAN unit 202, the NFC unit 201 and the line connectionunit 206 serves as a communication unit of the terminal 200.

A central processing unit (CPU) 211 which is a microprocessor disposedin the main board 210 operates according to a control program stored ina program memory 213 which is a read-only memory (ROM) and which isconnected to the CPU 211 via an internal bus 212, and according to theinformation in a data memory 214 which is a random-access memory (RAM).

The CPU 211 controls the wireless LAN unit 202 via a wireless LANcontrol circuit 215, thereby communicating with another communicationterminal through a wireless LAN 102. The CPU 211 controls the NFC unit201 via an NFC control circuit 216, thereby enabling detection of aconnection to another NFC terminal through NFC 101 and enablingreception/transmission of data from/to another NFC terminal. The CPU 211controls the line connection unit 206 via a line control circuit 217,whereby a connection to a mobile phone network 105 is established,enabling phone calls to be made and enabling data to bereceived/transmitted.

The CPU 211 controls an operation-unit control circuit 218, therebyenabling displaying to be performed on the operation unit 204 andenabling an operation to be received from a user. The CPU 211 controls acamera unit 219 so that an image is captured, and stores the capturedimage in an image memory 220 in the data memory 214. Other than capturedimages, the CPU 211 is capable of storing images obtained from theoutside through the mobile phone network 105 or the wireless LAN 102 inthe image memory 220, and of, in contrast, transmitting images to theoutside.

A nonvolatile memory 221 including a memory such as a flash memorystores data which is to be kept in the memory even after the powersupply is turned off. For example, in addition to telephone book data,various types of communication connection information, information aboutdevices which were connected to the terminal 200, or the like, imagedata to be kept in the memory and a program such as application softwarefor achieving various functions in the terminal 200 are stored.

FIG. 5 is a block diagram illustrating the configuration of the printer300. The printer 300 includes a main board 310 which controls the entireapparatus, a line connection unit 322, a wireless LAN unit 308, the NFCunit 306, and the operation display unit 305. The line connection unit322, the wireless LAN unit 308, and the NFC unit 306 serve ascommunication units of the printer 300.

A CPU 311 which is a microprocessor disposed in the main board 310operates according to a control program stored in a program memory 313which is a ROM and which is connected to the CPU 311 via an internal bus312, and according to the information in a data memory 314 which is RAM.

The CPU 311 controls a scanner unit 315 so that a document is read, andstores the read document in an image memory 316 in the data memory 314.The CPU 311 controls a print unit 317, thereby enabling an image in theimage memory 316 in the data memory 314 to be printed on a recordingmedium.

The CPU 311 controls the wireless LAN unit 308 through a wireless LANcontrol circuit 318, thereby enabling communication with anothercommunication terminal to be performed through the wireless LAN 102. TheCPU 311 controls the NFC unit 306 through an NFC control circuit 319,thereby enabling detection of a connection to another NFC terminalthrough the NFC 101 and enabling reception/transmission of data from/toanother NFC terminal. The CPU 311 controls the line connection unit 322through a line control circuit 321, whereby a connection to a telephonenetwork 323 is established, enabling FAX reception/transmission and datareception/transmission.

The CPU 311 controls an operation-display-unit control circuit 320,thereby enabling the state of the printer 300 or a menu for selecting afunction to be displayed on the operation display unit 305 and enablingan operation to be received from a user.

FIG. 6 is a block diagram illustrating the detail of an NFC unit 600used as the NFC unit 201 or the NFC unit 306.

In NFC communication, when near field communication is performed usingthe NFC unit 600, an apparatus which outputs a radio frequency (RF)field at first to start communication is called an initiator. Anapparatus which responds to a command submitted from the initiator andwhich communicates with the initiator is called a target.

The NFC unit 600 includes an NFC controller unit 601, an antenna unit602, an RF unit 603, a transmission-reception controller 604, an NFCmemory 605, a power supply 606, and a device connection unit 607. Theantenna unit 602 receives radio waves from another NFC device, andtransmits radio waves to another NFC device. The RF unit 603 is providedwith a function of modulating an analog signal to a digital signal anddemodulating a digital signal to an analog signal. The RF unit 603 whichincludes a synthesizer identifies bands and the frequencies of channels,and controls the bands and the channels by using frequency allocatingdata.

The NFC memory 605 includes, for example, a nonvolatile memory. Datastored in the NFC memory 605 may be read and written even in a state inwhich power from the power supply is not supplied. The control ofstoring data, including reading and writing data from/to the NFC memory605, is achieved by the NFC controller unit 601.

The transmission-reception controller 604 controls operations forreception/transmission, such as construction and decomposition of areception/transmission frame, addition and detection of a preamble, andframe identification. The transmission-reception controller 604 alsocontrols the NFC memory 605, and reads/writes various data and programs.When operations are performed in the active mode in which bi-directionalcommunication with a device is enabled, power is supplied via the powersupply 606. In addition, communication with another device is performedthrough the device connection unit 607, and communication with anotherNFC device located within a range in which communication may beperformed is performed by using radio waves received/transmitted throughthe antenna unit 602.

In the first embodiment, the terminal 200 and a printer need to performbi-directional communication through NFC. Therefore, the NFC alwaysoperates in the active mode.

In the description below, an operation in which the NFC unit 201 of theterminal 200 is brought to the vicinity of the NFC unit 306 of theprinter 300 is denoted as an “NFC touch operation”.

In the first embodiment, the following use case will be described. Auser selects images to be printed, by operating the terminal 200. Then,the user performs an NFC touch operation on the printer 300, using whichprinting is to be performed, whereby the selected images are printed byusing the printer 300.

When the printer 300 is present in the same network as the terminal 200,printing is performed while the connection state is maintained.Otherwise, a P2P connection to the printer 300 is established, andprinting is performed.

By using the flowchart in FIG. 7, the first embodiment will bedescribed. FIG. 7 illustrates a process performed when images specifiedby using the terminal 200 are printed by using the printer 300. Steps inthe flowchart which are related to the terminal 200 in the presentapplication are achieved by the CPU 211 reading programs associated withthe flowchart and executing the programs.

A user operates the terminal 200, selects image data, and performs anNFC touch operation on the printer 300. FIGS. 9A to 9E illustrate UIexamples of the terminal 200. For example, a user actives a printapplication installed in the terminal 200, whereby the selection screen(selection UI) in FIG. 9B is displayed. In the UI in FIG. 9B, thumbnailimages of image data in the terminal 200 are displayed. When a user tapsthe thumbnails of images to be printed, with a touch operation, checkmarks indicating selection are displayed on the thumbnails. In the statein which the images are selected, when the user performs an NFC touchoperation on the printer 300, a printing operation is started.

In step S1101, the terminal 200 obtains tag information from the NFC tagof the printer 300. The tag information includes at least three types ofinformation about network settings of the printer 300. Specifically, thethree types of information are (1) the MAC address of the printer 300,(2) the SSID and the password used when the printer 300 is in the APmode, and (3) the current wireless mode of the printer 300. The currentwireless mode in the information (3) is either one of the AP mode andthe infrastructure mode. The tag information in the present applicationmay be simply called communication information since the tag informationis information about communication.

In step S1102, the terminal 200 checks whether or not the wirelessfidelity (WiFi) setting is enabled. The WiFi setting being enabled meansthat WiFi communication is allowed to be performed in the terminal 200.If the WiFi setting is enabled, the process proceeds to step S1103. Ifthe WiFi setting is disabled, the process proceeds to step S1110.

In step S1103, the terminal 200 checks the current wireless mode of theprinter 300 which is included in the information (3) obtained in stepS1101. If the current wireless mode is the AP mode, the process proceedsto step S1112. If the current wireless mode is the infrastructure mode,the process proceeds to step S1104. That is, if the terminal 200determines that the printer 300 is operating by using the peer-to-peercommunication system, the terminal 200 proceeds the process to stepS1112.

In step S1104, the terminal 200 detects a printer 300 whose MAC addressmatches the MAC address of the printer 300 which is included in theinformation (1) obtained in step S1101. Specifically, the terminal 200transmits a device search command by broadcast to the network joined bythe terminal 200, and receives responses from apparatuses joining thenetwork. The terminal 200 detects a response including a MAC addressmatching the MAC address obtained in step S1101, thus performing theprocess in step S1104.

If a printer 300 is detected in step S1104, the terminal 200 establishesa wireless LAN connection to the printer 300 detected in step S1104, byusing the wireless LAN unit 202 in step S1106. Specifically, theterminal 200 determines (keeps) the access point 100 to which theterminal 200 has been connected, as a target to be connected. In stepS1109, the terminal 200 transmits a print job to the printer 300 throughthe wireless LAN via the access point 100. Specifically, the terminal200 issues a specific command to the printer 300, thereby establishing asession with the printer 300. The terminal 200 generates the print jobon the basis of the image data selected in the selection screen in FIG.9B, and transmits the print job in step S1109. The timing of generatinga print job may be set before the flowchart in FIG. 7 is performed, orafter a connection is established in step S1106.

The printer 300 which has received the print job prints the images onpaper on the basis of the print job, and the process ends.

If a printer 300 is not detected in step S1104, the process of theterminal 200 proceeds to steps S1105 to S1107.

In step S1107, the terminal 200 writes an instruction to make atransition to the AP mode, in the NFC tag of the printer 300. Theinformation written as an instruction to make a transition may be acommand to make a transition to the AP mode or may be informationindicating that a printer corresponding to the MAC address has not beenfound. When the printer 300 detects an instruction to make a transitionto the AP mode, which is written in the NFC tag, the printer 300 makes atransition to the AP mode.

In step S1108, using the SSID and the password of the access point ofthe printer 300 which are included in the information (2) obtained instep S1101, the terminal 200 establishes a wireless LAN connection tothe printer 300 which has made a transition to the AP mode in stepS1107. Specifically, the terminal 200 changes the access-pointconnection target from the access point 100 to the access point of theprinter 300. That is, in step S1108, the access point of the printer 300is determined to be the access-point connection target. This processcauses a P2P connection between the terminal 200 and the printer 300 tobe established, and the terminal 200 transmits the print job to theprinter 300 in step S1109. The process performed by the printer 300which has received the print job is the same as the above-describedprocess. In the case where the printer 300 is already in the AP modewhen an NFC touch operation is performed, the process proceeds to stepS1109 via step S1112. The wireless mode of the printer 300 is obtainedin the process in step S1101.

If the process proceeds to step S1110 in step S1102, the terminal 200changes the WiFi setting of the terminal 200 to enabled in step S1110.In step S1111, the terminal 200 writes an instruction to make atransition to the AP mode, in the NFC tag of the printer 300. When theprinter 300 detects an instruction to make a transition to the AP mode,which is written in the NFC tag, the printer 300 performs a process ofmaking a transition to the AP mode.

The process in step S1112 which is the same process as that in stepS1106 will not be described.

If the process proceeds to step S1112 in step S1103, the printer 300 isalready in the AP mode. Therefore, using the SSID and the password whichare used when the printer 300 is in the AP mode and which are includedin the information (2) obtained in step S1101, the terminal 200establishes a connection to the printer 300, and transmits the print jobto the printer 300 in step S1109. The printer 300 which has received theprint job performs a print process, and the process ends.

The steps in the flowchart in FIG. 7 may be executed by a printapplication providing the screens in FIGS. 9A to 9E.

According to a series of processes illustrated in the above-describedflowchart, when a connection between the printer 300 and the terminal200 has been established in the infrastructure mode, printing isperformed while the connection state is maintained. In contrast, when aconnection between the printer 300 and the terminal 200 has not beenestablished in the infrastructure mode, the terminal 200 instructs theprinter 300 to make a transition to the AP mode, and performs printing.

As a result, a connection in the infrastructure mode is maintained aslong as possible. Accordingly, connections to the Internet from theprinter 300 and the terminal 200 may be also maintained as long aspossible.

A user may easily set the WiFi setting of the terminal 200 enabled ordisabled at any timing by using a WiFi setting item in the systemsetting menu in the terminal 200. A user who does not own the accesspoint 100 does not need to establish a WiFi connection between theaccess point 100 and the terminal 200. Therefore, to reduce consumptionof the battery of the terminal 200 which is caused by unnecessaryfunctions, the WiFi setting of the terminal 200 may be highly likely tobe set disabled. Even in this case, the terminal 200 checks the WiFisetting in step S1102. When the WiFi setting is disabled, the terminal200 sets the WiFi setting enabled, and establishes a wireless connectionto the printer 300 in the AP mode, thereby enabling printing to beperformed in the AP mode.

In step S1103, the terminal 200 checks the wireless mode of the printer300. When the printer 300 is determined to already operate in the APmode, the terminal 200 does not perform the detection process in which aprinter 300 is unlikely to be found. According to the above-describedprocess, a connection between the printer 300 and the terminal 200 maybe effectively established.

As described above, the process of checking if the WiFi setting of theterminal 200 is enabled in step S1102 and the process of checking thewireless mode of the printer 300 in step S1103 are not necessary in thepresent invention, and are performed to improve customer convenience,such as making the process faster. Therefore, even when both or one ofsteps S1102 and S1103 is not performed, the present invention mayachieve an effect of maintaining a connection in the infrastructure modeas long as possible.

The process flow of the first embodiment will be described by using thescreens displayed on the mobile terminal 200.

In the terminal 200, the print application is activated, whereby thescreen in FIG. 9A is displayed. When a user selects photo printing, theprint application displays a list of images held in the terminal 200 asillustrated in FIG. 9B. When document printing is selected, a list ofdocuments held in the terminal 200 is displayed.

In the state in which the user selects images to be printed, in FIG. 9B,when the user performs an NFC touch operation on the printer 300 byusing the terminal 200, the print application displays the screen inFIG. 9C. Performing an NFC touch operation causes the process in FIG. 7of the present application as described above to be performed.

In the state in which the user selects images to be printed, in FIG. 9B,when the print button is pressed, the screen in FIG. 9D is displayed. Inthe state in which the screen in FIG. 9D is displayed, when the userperforms an NFC touch operation on the printer 300 by using the terminal200, printing is performed by using the print setting informationdisplayed in FIG. 9D.

A user may register a printer for the print application. In the state inwhich the screen in FIG. 9D is displayed, when the user performs an NFCtouch operation on a printer 300 different from the registered printer,the screen in FIG. 9E is displayed. At that time, the process in FIG. 7causes a wireless connection between the terminal 200 and the printer300 to be established. The terminal 200 obtains function information ofthe printer 300 (for example, the paper size and the paper type whichmay be handled by the printer 300) through the wireless connection, andreflects the obtained result on the screen in FIG. 9E. That is, theoptions displayed when a user presses the paper size field or the papertype field are determined on the basis of the function information ofthe printer 300 which is obtained through the wireless connection. Inthe screen in FIG. 9E, after the user sets the print settinginformation, when the user presses the print button, a print job istransmitted through the wireless connection to the printer 300 on whichthe user has performed an NFC touch operation.

Second Embodiment

In the first embodiment, when the terminal 200 and the printer 300 arenot present in the same network, the terminal 200 instructs the printer300 to make a transition to the AP mode. However, if it is possible forthe printer 300 to be connected again to the access point to which theterminal 200 has been connected, the printer 300 may be connected againto the access point.

Unless otherwise specified, the configurations of the apparatuses in thesecond embodiment are equivalent to those in the first embodiment, andwill not be described. Description will be made below by using FIG. 8.

In step S1201, the terminal 200 obtains tag information from the NFC tagof the printer 300. The tag information includes four types ofinformation about network settings of the printer 300. Specifically, inaddition to the information (1) to (3) described above, information (4)which describes a connection history of SSIDs corresponding to accesspoints to which the printers 300 was connected is included. For theinformation (4) about a connection history, passwords corresponding tothe SSIDs are separately held in the printer 300, not in the tag.

Step S1202 is the same as step S1104, and step S1203 is the same as stepS1105. Accordingly, the detailed description will not be made. If aprinter 300 is not detected in step S1203, the process proceeds to stepS1206 from step S1203.

In step S1206, the SSID of the access point to which the terminal 200has been connected is compared with the connection history of SSIDs ofaccess points which is included in the information (4) obtained in stepS1201, and whether or not an SSID in the connection history matches theSSID is checked. If no SSIDs match the SSID, the process proceeds tostep S1207. If an SSID matches the SSID, the process proceeds to stepS1209.

The processes in steps S1207, S1208, and S1205 are the same as those insteps S1107, S1108, and S1109, and the detailed description will not bemade. If it is determined that the determination result in step S1206 isYES, the terminal 200 writes the SSID matched in step S1206 and aninstruction to establish a connection to the access point, in the NFCtag of the printer 300 in step S1209. When the printer 300 detects aninstruction to establish a connection to the access point, which iswritten in the NFC tag, the printer 300 uses the SSID specified by theterminal 200 and the password stored along with the access-pointhistory, so as to establish a connection to the access point again.Thus, the terminal 200 and the printer 300 are connected to the sameaccess point, thereby being connected in the same network.

In step S1210, the terminal 200 performs broadcasting to the network,detects a printer 300 whose MAC address matches the MAC address of theprinter 300 which is included in the information (1) obtained in stepS1201, and establishes a wireless connection to the detected printer300. The specific process in step S1210 is the same as that in stepS1106. In step S1205, the terminal 200 transmits a print job to theprinter 300 via the established wireless connection. The printer 300which has received the print job performs printing, and the processends.

As described above, according to the second embodiment, the terminal 200uses the connection history of access points which is held in theprinter 300, enabling the terminal 200 to be connected to the printer300 via an access point. As a result, the state in which both of theterminal 200 and the printer 300 are connectable to the Internet may bemaintained with a higher probability.

In the second embodiment, the example in which a connection history ofaccess points for the printer 300 is held is described. In contrast, theterminal 200 may hold a connection history (SSID) of access points forthe terminal 200. In this case, in step S1201, instead of the connectionhistory of SSIDs corresponding to access points for the printer 300which is included in the information (4), the terminal 200 obtains theSSID of the access point to which the printer 300 has been connected. Instep S1206, the terminal 200 compares SSIDs in the connection history ofthe terminal 200 with the SSID, which is obtained in step S1201, of theaccess point to which the printer 300 has been connected. If an SSID inthe connection history matches the SSID, the terminal 200 may set theconnection target to the access point for the matched SSID again.

In the embodiments of the present invention, the examples in which thepresent invention is applied to the printer 300 are described. Similarlyto the printer, the present invention is applicable to a digital camerahaving a WiFi connection function and a P2P connection function.Specifically, when a terminal is to function as a remote controller of adigital camera, while connections to the Internet from the terminal andthe digital camera are maintained as long as possible, for example, anoperation of clicking the shutter of the connected digital camera may beperformed from the terminal.

In the case where a terminal is to function as a remote controller forapparatuses, such as a network audio player and a video recorder, aremote control function may be also achieved while a connection to theInternet from each of the apparatuses is maintained as long as possible.

Therefore, the scope in which the present invention is applied is notlimited to a printer.

In the embodiments, the example using the AP mode is described as anexample of a P2P connection between a terminal and an apparatus.However, in the case where other P2P connection methods, such as aBluetooth connection and a Wi-Fi Direct connection, hinder a connectionto the Internet in both or one of the terminal and the apparatus, thepresent invention may be applied. As a result, an effect that anInternet connection in each of the apparatuses is maintained as long aspossible may be achieved.

As an example of a P2P connection between a terminal and an apparatus,the example using the AP mode is described. However, in establishment ofa P2P connection, the printer 300 does not need to function as an AP.Specifically, in a Wi-Fi Direct P2P connection, one apparatus operatesas a host and the other apparatus operates as an AP. However, in thespecification, which serves as an AP depends on the condition. In thepresent invention, when a P2P connection is enabled, the presentinvention may achieve the effect even if either one of the terminal andthe printer serves as an AP. Therefore, the present invention is notnecessarily limited to the case in which the printer serves as an AP.When a Wi-Fi Direct P2P connection is to be established in the processof the present application, negotiations are performed between theterminal and the printer, and either one of the terminal and the printeris determined to operate as an AP.

As an example of near field communication, the example using NFC isdescribed. Instead of NFC, Bluetooth may be used.

In the present application, the process in which the terminal 200 usesthe MAC address obtained from the printer 300, so as to search for theprinter 300 is described. However, another method may be employed inwhich the terminal 200 obtains the IP address and the MAC address byusing NFC and searches for the printer 300 by using the IP address. Whenthe terminal 200 does not find the printer 300 by using the IP address,the terminal 200 may search for the printer 300 again by using the MACaddress. This process enables the search process to be efficientlyperformed.

Alternatively, device information, such as the model name and the typeof the printer 300, may be transmitted to the terminal 200 through NFC.When the device information of printers which may be used by the printapplication of the terminal 200 does not match the device informationobtained through an NFC touch operation (for example, when the modelnames do not match each other), the print application displays an errorscreen. A message indicating that it is impossible to continue theprinting is displayed on the error screen. On the error screen, amessage indicating printers which may be used by the print application,a message for recommending use of another print application, or the likemay be displayed.

In addition, function information of the printer 300 may be transmittedto the terminal 200 through NFC. When a function selected in the screenin FIG. 9A provided by the print application of the terminal 200 is notincluded in the function information obtained through an NFC touchoperation, the print application displays an error screen. A messageindicating that it is impossible to continue the process may bedisplayed on the error screen. Specifically, in the case where faxing isselected in FIG. 9A, and where a scan function is not included in thefunction information obtained from the printer 300 through an NFC touchoperation, the print application stops the FAX process and displays anerror screen.

Third Embodiment

In the first embodiment, in the case where the WiFi setting of theterminal 200 is enabled and where the printer 300 has not established aWiFi connection, the process proceeds to step S1107 via steps S1101 toS1105. At that time, in step S1107, the terminal 200 writes aninstruction to make a transition to the AP mode, in the NFC tag of theprinter 300, causing the printer 300 to make a transition to the APmode. Therefore, for a period from the start of the process in stepS1101 to the end of the process in step S1107, a user should not movethe terminal 200 away from the printer 300. Specifically, the distancebetween the terminal 200 and the printer 300 should be a distance withwhich NFC communication may be performed.

Before the terminal 200 completes the process in step S1107, the usermay change the position of the terminal 200 which is being touched, ormay move the terminal 200 away from the printer 300. As a result, NFCcommunication may fail to be performed in step S1107, and an instructionto make a transition to the AP mode may fail to be carried out, causingthe communication between the terminal 200 and the printer 300 to end upwith a connection error. When a connection error occurs in step S1107,the user performs a touch operation again, and the flow from steps S1101to S1107 is performed again. At that time, simple repetition of the sameprocesses alone may cause another connection error because the usermoves the terminal 200 away from the printer 300 or changes the positionof the terminal 200 again.

When a connection error occurs in step S1107, a process for reducing theprobability of occurrence of a connection error may be performed.

Unless otherwise specified, the configurations of the apparatuses in athird embodiment are equivalent to those in the first embodiment, andwill not be described. Description will be made below by referring toFIG. 10.

Before the process illustrated in FIG. 10 is described, assume thefollowing case. A user performs an NFC touch operation on the printer300 by using the terminal 200 so as to try to establish a connection.Before the process in step S1107 is completed, the user moves theterminal 200 away from the printer 300. In this case, the printer 300has not adequately received an instruction to make a transition to theAP mode. Therefore, the printer 300 has not made a transition to the APmode. As a result, the terminal 200 fail to establish a connection tothe printer 300. At that time, the terminal 200 holds connection errorinformation in the nonvolatile memory 221 in the terminal 200. Theconnection error information is updated at the end of the process instep S1307 described below. When a connection error for the printer 300occurs in the process in step S1307, the MAC address of the printer 300on which the failed operation of establishing a connection was performedis stored along with a setting value indicating the occurrence of aconnection error. If a connection error does not occur in step S1307, asetting value indicating that no connection errors occur is stored. Whenthe process in step S1307 has never performed, a setting value for thecase in which no connection errors occur is stored as an initial value.

A process flow using the error information will be described.

In step S1301, the terminal 200 obtains tag information from the NFC tagof the printer 300. The tag information includes three types ofinformation about network settings of the printer 300, which are similarto those in the first embodiment.

Steps S1302 and S1309 are the same as steps S1103 and S1112, and willnot be described in detail.

In step S1302, if it is determined that the printer 300 is not in the APmode, the process proceeds to step S1303.

In step S1303, the terminal 200 obtains the connection error informationstored in the terminal 200. The terminal 200 determines whether or notthe following condition is satisfied: (1) the connection errorinformation includes a setting value indicating that an error occurred,and (2) the MAC address of the printer 300 obtained in step S1301matches the MAC address of the printer 300 included in the errorinformation. If it is determined that the determination result in stepS1303 is YES, the terminal 200 skips steps S1304 to S1305, and proceedsthe process to step S1307.

If it is determined that the determination result in step S1303 is NO,the process proceeds to step S1304. Steps S1304 to S1306 are the sameprocesses as those in steps S1104 to S1106, and will not be described indetail.

In step S1307, a process equivalent to that in step S1107 is performed,and the connection error information is updated at the end.

Step S1310 is the same process as that in step S1109, and will not bedescribed in detail.

As described above, in the third embodiment, when a connection error dueto an NFC touch occurred last time, the process (which is the process instep S1305, and which is also referred to as a determination process) inwhich a printer is specified and which relatively takes time may beskipped. As a result, a time till an instruction to make a transition tothe AP mode is supplied when touching is performed again may be reduced.Thus, even in the case where a user moves the terminal 200 away from theprinter 300 just after the user performs a touch operation, theprobability of producing another connection error may be reduced.

When a connection error occurs, a user is highly likely to performanother touch operation at once. Therefore, time information about whenthe error occurred may be included in the connection error information.Specifically, in the determination in step S1303, the current time iscompared with the time information which indicates when an erroroccurred and which is included in the connection error information. Ifthe difference between the time when an error occurred last time and thecurrent time is within a predetermined time (for example, within 10seconds) and if the MAC addresses match each other, the process mayproceed to step S1307.

The current connection state of the printer 300 may be used in thedetermination condition. Specifically, the tag information obtained instep S1301 includes information about whether or not the printer 300 hasbeen connected in the infrastructure mode. This information is stored asthe connection error information when an error occurs. In thedetermination in step S1303, if a connection error occurred in stepS1307 last time and if the state of the wireless mode which is obtainedin step S1301 matches the state of the wireless mode which is includedin the connection error information, the process proceeds to step S1307.

In step S1303, the determination condition for determining whether ornot the process skips the process of specifying a printer 300 andproceeds to step S1307 may be one of the conditions of, for example, theMAC address, the elapsed time, and a change in the connection state ofthe printer 300, or may be a combination of these. The determinationcondition itself may be any as long as it is information from which itmay be determined that the state of the printer 300 is possibly changed,such as a change of the IP address of the printer 300 or a change of theSSID in the AP mode.

The present invention enables customer convenience to be improved byperforming wireless communication in consideration of the connectionstate of a communication target apparatus.

Other Embodiments

Embodiment(s) of the present invention can also be realized by acomputer of a system or apparatus that reads out and executes computerexecutable instructions (e.g., one or more programs) recorded on astorage medium (which may also be referred to more fully as a‘non-transitory computer-readable storage medium’) to perform thefunctions of one or more of the above-described embodiment(s) and/orthat includes one or more circuits (e.g., application specificintegrated circuit (ASIC)) for performing the functions of one or moreof the above-described embodiment(s), and by a method performed by thecomputer of the system or apparatus by, for example, reading out andexecuting the computer executable instructions from the storage mediumto perform the functions of one or more of the above-describedembodiment(s) and/or controlling the one or more circuits to perform thefunctions of one or more of the above-described embodiment(s). Thecomputer may comprise one or more processors (e.g., central processingunit (CPU), micro processing unit (MPU)) and may include a network ofseparate computers or separate processors to read out and execute thecomputer executable instructions. The computer executable instructionsmay be provided to the computer, for example, from a network or thestorage medium. The storage medium may include, for example, one or moreof a hard disk, a random-access memory (RAM), a read only memory (ROM),a storage of distributed computing systems, an optical disk (such as acompact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™),a flash memory device, a memory card, and the like.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

What is claimed is:
 1. A control method of a communication apparatuscapable of wirelessly connecting with an external access point providedexternally to the communication apparatus and externally to a printerand with the printer, the control method comprising: receiving selectionof an image; executing second wireless communication for transmitting aprinting job for printing the selected image by direct wirelessconnection without executing first wireless communication with theprinter after the selection of the image is received, in a case where,after the selection of the image is received, the printer is operated ina predetermined state that an access point included in the printer isenabled, wherein the direct wireless connection is connection betweenthe access point included in the printer and the communication apparatuswithout using the external access point; executing third wirelesscommunication for transmitting the printing job by direct wirelessconnection after executing the first wireless communication with theprinter after the selection of the image is received, in a case where,after the selection of the image is received, the printer is notoperated in the predetermined state and the printer is not included in anetwork including the communication apparatus and the external accesspoint; and executing, based on communication executed by a shorter rangecommunication method, fourth wireless communication for transmitting theprinting job by connection between the printer and the communicationapparatus via the external access point, in a case where, after theselection of the image is received, the printer is not operated in thepredetermined state and the printer is included in the network includingthe communication apparatus and the external access point, wherein thefirst wireless communication is executed by the shorter rangecommunication method with a communication range shorter than acommunication range of the second wireless communication, acommunication range of the third wireless communication and acommunication range of the fourth wireless communication.
 2. The controlmethod according to claim 1, further comprising: executing predeterminedprocessing of broadcasting a predetermined command to the networkincluding the communication apparatus and the external access point; anddetermining whether a response to the predetermined command is obtainedfrom the printer by the predetermined processing, wherein the printer isincluded in the network including the communication apparatus and theexternal access point in a case where it is determined that the responseto the predetermined command is obtained from the printer by thepredetermined processing, and the printer is not included in the networkincluding the communication apparatus and the external access point in acase where it is determined that the response to the predeterminedcommand is not obtained from the printer by the predeterminedprocessing.
 3. The control method according to claim 2, wherein thepredetermined processing is not executed in a case where the printer isnot operated in the predetermined state after the selection of the imageis received, and the predetermined processing is executed in a casewhere the printer is operated in the predetermined state after theselection of the image is received.
 4. The control method according toclaim 2, wherein identification information about the printer isobtained by the first wireless communication, and wherein it isdetermined that the response to the predetermined command is obtainedfrom the printer by the predetermined processing in a case whereinformation matching the identification information obtained by thefirst wireless communication is obtained by the predeterminedprocessing, and it is determined that the response to the predeterminedcommand is not obtained from the printer by the predetermined processingin a case where the information matching the identification informationobtained by the first wireless communication is not obtained by thepredetermined processing.
 5. The control method according to claim 4,wherein the identification information is a MAC address of the printer.6. The control method according to claim 1, wherein informationindicating whether the printer is operated in the predetermined state isobtained from the printer by the communication by the shorter rangecommunication method, and wherein the second wireless communication isexecuted without executing the first wireless communication after theimage is selected, in a case where information indicating that theprinter is operated in the predetermined state is obtained from theprinter by the first wireless communication.
 7. The control methodaccording to claim 1, wherein an instruction is issued to operate theprinter in the predetermined state by the first wireless communicationin a case where the printer is not operated in the predetermined stateand the printer is not included in the network including thecommunication apparatus and the external access point after the selectinof the image is accepted.
 8. The control method according to claim 1,wherein the second wireless communication is executed based on thecommunication by the shorter range communication method, and the thirdwireless communication is executed based on the communication by theshorter range communication method.
 9. The control method according toclaim 8, wherein the second wireless communication is executed withoutexecuting the first wireless communication after the selection of theimage is received in a case where, after the selection of the image isreceived, a setting of wireless communication to be used fortransmitting the print job is enabled in the communication apparatus andthe printer is operated in the predetermined state, wherein the thirdwireless communication is executed after the first wirelesscommunication with the printer after the image is selected is executed,in a case where, after the selection of the image is received, thesetting of the wireless communication to be used for transmitting theprint job is enabled in the communication apparatus, the printer is notoperated in the predetermined state, and the printer is not included inthe network including the communication apparatus and the externalaccess point, wherein the fourth wireless communication is executed, ina case where, after the selection of the image is received, the settingof the wireless communication to be used for transmitting the print jobis enabled in the communication apparatus, the printer is not operatedin the predetermined state, and the printer is included in the networkincluding the communication apparatus and the external access point, andwherein fifth wireless communication for transmitting the print job bythe direct wireless communication is executed after the first wirelesscommunication with the printer after the image is selected is executed,in a case where, after the selection of the image is received, thesetting of the wireless communication to be used for transmitting theprint job is disabled.
 10. The control method according to claim 9,wherein the setting of the wireless communication to be used fortransmitting the print job is to be enabled, in a case where, after theselection of the image is received, the setting of the wirelesscommunication to be used for transmitting the print job is disabled. 11.The control method according to claim 1, wherein information forestablishing the direct wireless communication is obtained from theprinter by the communication by the shorter range communication method.12. The control method according to claim 1, wherein the first wirelesscommunication is communication by near field communication.
 13. Thecontrol method according to claim 1, wherein the first wirelesscommunication is communication by Bluetooth.
 14. The control methodaccording to claim 1, wherein the second wireless communication, thethird wireless communication and the fourth wireless communication arecommunication by Wi-Fi.
 15. A non-transitory computer-readable mediumstoring therein a control program which when executed by a computerexecutes the control method according to claim
 1. 16. The control methodaccording to claim 1, wherein the third wireless communication isexecuted based on a fact that the printer is not included in the networkincluding the communication apparatus and the external access point. 17.The control method according to claim 1, wherein the fourth wirelesscommunication is executed based on a fact that the printer is includedin the network including the communication apparatus and the externalaccess point.
 18. A communication apparatus capable of wirelesslyconnecting with an external access point provided externally to thecommunication apparatus and externally to a printer and with theprinter, the communication apparatus comprising: at least one processorconfigured to perform: receiving selection of an image; executing secondwireless communication for transmitting a print job for printing theselected image by direct wireless connection without executing firstwireless communication with the printer after the selection of the imageis received, in a case where, after the selection of the image isreceived, the printer is operated in a predetermined state that anaccess point included in the printer is enabled, wherein the directwireless connection is connection between the access point included inthe printer and the communication apparatus without using the externalaccess point; executing third wireless communication for transmittingthe print job by direct wireless connection after executing the firstwireless communication with the printer after the selection of the imageis received, in a case where, after the selection of the image isreceived, the printer is not operated in the predetermined state and theprinter is not included in a network including the communicationapparatus and the external access point; and executing, based oncommunication executed by a shorter range communication method, fourthwireless communication for transmitting the printing job by connectionbetween the printer and the communication apparatus via the externalaccess point, in a case where, after the selection of the image isreceived, the printer is not operated in the predetermined state and theprinter is included in the network including the communication apparatusand the external access point, wherein the first wireless communicationis executed by the shorter range communication method with acommunication range shorter than a communication range of the secondwireless communication, a communication range of the third wirelesscommunication and a communication range of the fourth wirelesscommunication.